import request from '@/utils/request'
import { tokenName } from '@/config/setting.config'
import axios from "axios";
export function getUserInfo(accessToken) {
  return request({
    url: '/userInfo',
    method: 'post',
    data: {
      [tokenName]: accessToken,
    },
  })
}

export function register() {
  return request({
    url: '/register',
    method: 'post',
  })
}

export function getFaqList(pageNum, pageSize) {
  return request({
    url: `http://localhost:7000/customer/customer/getFaqLists/${pageNum}/${pageSize}`,
    method: 'post',
  })
}

// export function unifiedOrder (orderId,total_fee,body){
//   return request({
//     url: `http://localhost:7000/shop/pay/unifiedOrder/${orderId}/${total_fee}/${body}`,
//     method: 'post'
//   })
//
// }

export function orderQuery (orderId){
  return axios.get(`/pay/orderQuery/${orderId}`);
}

export const getCart = ()=>{
  return axios.get(`/cart/getCart`)
}

export const createOrder = (orderItemList)=>{
  return axios.post(`/order/create`,orderItemList)
}

export const findPage = (pageNo,pageSize, searchMap)=>{
  return axios.post(`/order/findPage/${pageNo}/${pageSize}`,searchMap);
}
